An optimization task is a task of finding a best solution to a problem from all feasible solutions to the problem. To perform an optimization task, quantum hardware, e.g., a quantum computing device, may be constructed and programmed to encode the solution to a corresponding machine optimization problem into an energy spectrum of a many-body quantum Hamiltonian characterizing the quantum hardware. For example, the solution is encoded in the ground state of the Hamiltonian.